powered by
This function assigns cluster id to each observation in x according to the desired model emobj or specified parameters pi, Mu, and LTSigma.
x
emobj
pi
Mu
LTSigma
assign.class(x, emobj = NULL, pi = NULL, Mu = NULL, LTSigma = NULL, lab = NULL, return.all = TRUE)
This function returns a list containing mainly two new variables:
nc (length \(K\) numbers of observations in each class) and
nc
class (length \(n\) class id).
class
the data matrix, dimension \(n\times p\).
the desired model which is a list mainly contains pi, Mu, and LTSigma, usually a returned object from init.EM.
init.EM
the mixing proportion, length \(K\).
the centers of clusters, dimension \(K\times p\).
the lower triangular matrices of dispersion, dimension \(K\times p(p+1)/2\).
labeled data for semi-supervised clustering, length \(n\).
if returning with a whole emobj object.
Wei-Chen Chen wccsnow@gmail.com and Ranjan Maitra.
This function are based either an input emobj or inputs pi, Mu, and LTSigma to assign class id to each observation of x.
If lab is submitted, then the observation with label id greater 0 will not be assigned new class.
lab
https://www.stat.iastate.edu/people/ranjan-maitra
init.EM, emcluster.
emcluster
library(EMCluster, quietly = TRUE) set.seed(1234) x2 <- da2$da ret <- init.EM(x2, nclass = 2) ret.new <- assign.class(x2, ret, return.all = FALSE) str(ret.new)
Run the code above in your browser using DataLab